package com.haima.sage.bigdata.api.entity;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

import static javax.persistence.CascadeType.REFRESH;

@Entity
@Table(name = "t_compute_task")
public class ComputeTask {
    @Id
    private String id;
    @Column(nullable = false)
    private String name;
    @Lob
    @Column(nullable = false)
    private String data;
    private String description;
    private Date createDate;
    private Date updateDate;

    @ManyToMany(fetch=FetchType.EAGER, cascade = {REFRESH})
    @JoinTable(
            name="t_compute_task_app_system",
            joinColumns=@JoinColumn(name="task_Id", referencedColumnName="id"),
            inverseJoinColumns=@JoinColumn(name="sys_id", referencedColumnName="id"))
    private List<AppSystem> systems;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public List<AppSystem> getSystems() {
        return systems;
    }

    public void setSystems(List<AppSystem> systems) {
        this.systems = systems;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }
}
